import Vue from 'vue'
import VueRouter from 'vue-router'
import indexLayout from '../layout/indexLayout'

Vue.use(VueRouter)


const routes = [
  {
    path: '/unLogin',
    name:'loginIndex',
    component: () => import('../views/unLogin'),
  },
  {
    path: '/',
    redirect:'home'
  },
  {
    path: '/home',
    component: indexLayout,
    children:[
      {
        path:'',
        name: 'home',
        component: () => import('../views/index'),
      },
      {
        path:'/personal',
        name: 'personalCenter',
        component: () => import('../views/user'),
      },
      {
        path:'/answerQuestions',
        name:'answerQuestions',
        component:()=> import('../views/answerQuestions/answerQuestions')
      },
      {
        path:'/answerQuestionsDetail',
        name:'answerQuestionsDetail',
        component:()=> import('../views/answerQuestions/answerQuestionsDetail')
      },
      {
        path:"/Dynamicpages",
        name:"Dynamicpagess",
        component:()=>import("../views/Dynamicpages/Dynamicpages")
      },

      {
        path:'/course',
        name: 'courseAssignments',
        component: () => import('../views/courseAssignments'),
        children:[
          {
            path:'/homework',
            name:'homework',
            component:()=> import('../views/courseAssignments/homework')
          },
          {
            path:'/homeworkDetail',
            name:'homeworkDetail',
            component:()=> import('../views/courseAssignments/homeworkDetail')
          },
          {
            path:'/exercisesDetail',
            name:'exercisesDetail',
            component:()=> import('../views/courseAssignments/exercisesDetail')
          },

          {
            path:'/homeworkList',
            name:'homeworkList',
            component:()=> import('../views/courseAssignments/homeworkList')
          },
          {
            path:'/test',
            name:'test',
            component:()=> import('../views/courseAssignments/test')
          },
          {
            path:'/testDetail',
            name:'testDetail',
            component:()=> import('../views/courseAssignments/testDetail')
          },
          {
            path:'/exercises',
            name:'exercises',
            component:()=> import('../views/courseAssignments/exercises')
          },
          {
            path:'/exercisesDetail',
            name:'exercisesDetail',
            component:()=> import('../views/courseAssignments/exercisesDetail')
          },
          {
            path:'/homeworkSubmitted',
            name:'homeworkSubmitted',
            component:()=> import('../views/courseAssignments/homeworkSubmitted')
          },

        ]
      },
      {
        path:'/study',
        name: 'study',
        component: () => import('../views/study'),
        children: [
          {
            path:'/material',
            name:'material',
            component:()=> import('../views/study/material')
          },{
            path:'/problem',
            name:'problem',
            component:()=> import('../views/study/exercises')
          },
          {
            path:'/problemDetail',
            name:'studyExercisesDetail',
            component:()=> import('../views/study/exercisesDetail')
          },
          {
            path:'/videoPage',
            name:'videoPage',
            component:()=> import('../views/study/videoPage')
          },
        ]
      },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
